<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>弹性子元素伸缩</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
            width: 800px;
            text-align: center;
            font-size: 20px;
            font-weight: bold;
            border: 10px solid red;

            display: flex;
            flex-flow: row nowrap;
            /*flex-flow: row wrap;*/

        }

        li,a {
            /* width: 100px; */
            line-height: 100px;
            /* 弹性子元素在主轴上的宽度, 基础大小, 根据主轴方向自动设置width或者height */
            flex-basis: 200px;
            /* 伸缩系数, 当父元素容纳不下的时候, 弹性子元素的收缩性质*/
            /* 可以单独设置, 配置不同的收缩系数 */
            flex-shrink: 1;
            /* 生长系数, 父元素有空白时, 弹性子元素如何生长 */
            flex-grow: 1;

            /* flex-shrink flex-grow flex-basis 的复合属性 */
            /* 使用最多 */
            flex: 1 1 auto; 
        }

        li:nth-child(1) {
            background-color: #bfa;
        }

        li:nth-child(2) {
            background-color: tomato;
            flex-shrink: 2;
        }

        li:nth-child(3) {
            background-color: skyblue;
            flex-shrink: 3;
        }

        li:nth-child(4) {
            background-color: greenyellow;
            flex-shrink: 4;
        }

        li:nth-child(5) {
            background-color: orchid;
            flex-shrink: 5;
        }
    </style>
</head>
<body>

<ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
<!--    <a href="#">a</a>-->
</ul>
</body>
</html>